Skip to content

Conversation

szehon-ho
Copy link
Member

What changes were proposed in this pull request?

Fix the analysis of default value expression to not include column names

Why are the changes needed?

The following query:

CREATE TABLE t (current_timestamp DEFAULT current_timestamp)

fails with an exception:

[INVALID_DEFAULT_VALUE.NOT_CONSTANT] Failed to execute CREATE TABLE command because the destination column or variable `current_timestamp` has a DEFAULT value CURRENT_TIMESTAMP, which is not a constant expression whose equivalent value is known at query planning time. SQLSTATE: 42623;

This is because , to create a default value DSV2 expression, the code now uses the main analyzer to analyze the default value, which resolves it to the column current_timestamp. However, analyzer should not try to resolve default value to other columns.

Does this PR introduce any user-facing change?

Should fix a regression

How was this patch tested?

Add new unit test in DataSourceV2SQLSuite

Was this patch authored or co-authored using generative AI tooling?

No

@github-actions github-actions bot added the SQL label Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant